package org.example.mydeom.exception.handler;

import lombok.extern.slf4j.Slf4j;
import org.example.mydeom.exception.BaseException;
import org.example.mydeom.result.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
    @ExceptionHandler
    public Result<String> handleException(BaseException e) {
        log.error("异常信息: {}", e.getMessage());
        return Result.error(e.getMessage());
    }
}

